!include 'global.f95'
include "./routine.f95"
program main
    use routine
    implicit none
    integer(kind=4) :: i,j
    integer :: fileunit
    character(len=20) :: filename(4)
    real(kind=4),parameter :: cfls(4)=(/0.25, 0.5, 0.75, 1.0/)
    filename(1)='cfl_0.25.bin'
    filename(2)='cfl_0.5.bin'
    filename(3)='cfl_0.75.bin'
    filename(4)='cfl_1.0.bin'
!$OMP PARALLEL DO num_threads(4) PRIVATE(j,fileunit)
    do j=1,4
        fileunit = 233+j
        open(unit=fileunit,file=filename(j),form='unformatted',access='direct',recl=4)
        call init
        CFL=cfls(j)
        call output(fileunit,NX)
        call output(fileunit,NTEND)
        call output(fileunit,x)
        call output(fileunit,t)
        call output(fileunit,u2)
        do i=1,NTEND
            do while(t<TEND(i))
                call getB
                call DF
            end do
            call output(fileunit,t)
            call output(fileunit,u2)
        end do
        close(fileunit)
    end do
!$OMP END PARALLEL DO
end program
